package com.juzipi.demo.mapper;

import com.juzipi.demo.dto.TeacherStudent;
import com.juzipi.demo.pojo.Teacher;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface TeacherMapper extends Mapper<Teacher> {


    @Select("select t1.*,t3.name from stu_teacher t1 left join stu_teacher_subject t2 on t1.id = t2.tid left join stu_subject t3 on t2.subid = t3.id where t1.name like \"%\" #{key} \"%\" ")
    List<Teacher> queryTeacherAndSubject(String key);


    @Select("select t1.name as tname,t2.date,t3.name,t3.age,t3.gender,t3.info from stu_teacher t1 left join stu_teacher_student t2 on t1.id = t2.tid left join stu_student t3 on t2.sid = t3.id where t1.name like \"%\" #{key} \"%\" ")
    List<TeacherStudent> queryTeacherStudent(String key);


}
